<?php 
namespace Admin\Model;
use Think\Model;

class CateModel extends Model{

	/**
	* @return array 返回栏目树
	*
	*/
	public function getTree($id=0,$lev=0){
		static $arr=[];
		$cate = $this->select();
		foreach($cate as $v){
			if($v['parent_id'] == $id){
				$v['lev'] = $lev;
				$arr[] = $v;
				$this->getTree($v['cat_id'],$lev+1);
			}
		}
		return $arr;
	}
}